<?php
namespace common\models;

use yii\base\Model;

/**
 * 错误码模型
 * @author CGA
 */
class OperateErrors extends Model
{
    /**
     * 预定义错误信息
     */
    public static $errors = [
        '100002' => "发送过于频繁,请60秒后重试",
        '100003' => "验证过于频繁,请30秒后重试",
        '100010' => '未登录用户',
        '100011' => '邮箱验证码错误',
        '100012' => '手机验证码错误',
        '100013' => '用户未绑定邮箱',
        '100014' => '用户未绑定手机号',
        '100015' => '用户账号不合法',
        '100016' => '非本系统邮箱',
        '100017' => '链接已经失效',
        '100018' => 'token不合法',
        '100019' => '非本系统手机号',
        '100021' => '用户不存在',
        '100022' => '登录失败',
        '100023' => '账号格式错误，请输入正确的邮箱或手机号',
        '100031' => '该支付方式已绑定',
        '100032' => '支付方式不存在',
        '100033' => '请先绑定支付方式',
        '100035' => '支付方式信息异常',
        '100041' => '该提币地址已绑定',
        '100042' => '提币地址不存在',
        '100043' => '钱包请求失败',
        '100044' => '钱包地址信息错误',
        '100045' => '钱包地址存储失败',
        '100046' => '该钱包地址已绑定，请重新生成',

        '200002' => '角色信息获取失败',
        '200003' => '用户角色授权失败',
        '200004' => '验证码错误',
        '200005' => '原手机验证码错误',
        '200006' => '新手机验证码错误',
        '200008' => '原邮箱验证码错误',
        '200009' => '新邮箱验证码错误',

        '300001' => '该用户无法成为经纪人',
        '300002' => '无权指定经纪人',
        '300003' => '经纪人不存在',
        '300004' => '该经纪人不担保该币种的交易',
        '300005' => '该经纪人的担保额不足，请重新选择',
        '300006' => '不能指定交易双方作为经纪人',
        '300007' => '对方已是信任的纪经人',
        '300008' => '信任纪经人不存在',

        '400001' => '该币种已存在',
        '400002' => '用户资产数据异常',
        '400003' => '余币不足',
        '400004' => '预设担保额不能小于当前担保额',
        '400005' => '无效币操作类型',
        '400006' => '币操作记录添加失败',
        '400007' => '账户余额更新失败',
        '400008' => '冻结余额不足',
        '400009' => '对方账户收币失败',
        '400010' => '担保额不足',
        '400011' => '担保信息更新失败',
        '400051' => '不能与自己交易',

        '500001' => '交易单号的评价已存在,无法创建评价',
        '500002' => '创建交易单号评价失败',
        '500003' => '交易单号评价信息获取失败',
        '500004' => '订单不存在',
        '500005' => '订单响应时间更新失败',
        '500006' => '订单状态更新失败',
        '500007' => '非订单相关人员',
        '500008' => '该订单已操作',
        '500009' => '订单已被取消',
        '500010' => '订单已开始正式交易，无法更换经纪人',
        '500011' => '需求编号不存在',
        '500012' => '购买方式不存在',
        '500013' => '购买数量大于最大限额',
        '500014' => '购买数量小于最低限额',
        '500015' => '购买数量大于剩余数量',
        '500016' => '需求已过期',
        '500017' => '订单信息异常',
        '500018' => '无权确认买家已转款',
        '500101' => '非订单经纪人',
        '500102' => '该订单不可操作',
        '500103' => '平台资产信息异常',
        '500104' => '平台资产信息更新失败',

        '600001' => '留言类型不正确',

        '700001' => '已经实名验证过,无法再次验证'
    ];

    /**
     * 获取错误信息
     */
    public static function getMessage($code)
    {
        $message = isset(self::$errors[$code]) ? self::$errors[$code] : '未知错误';
        return $message;
    }
}
